home *** CD-ROM | disk | FTP | other *** search
- /* ---------------------------------------------
- * File: I8255GEN.H
- * Creator: Blake Miller
- * Version: 01.00.00 September 1990
- * Language: Microsoft Quick C Version 2.0
- * Purpose: Intel 8255 Digital IO Functions
- * Generic Header File
- * ---------------------------------------------
- */
-
- #define I8255GEN_H_DEFINED 1
-
- /* The address definitions are set up for the 8255.
- * The base address should be passed to
- * the I8255_init() function.
- */
- #define I8255_PORTA(X) (X + 0) /* PORT A */
- #define I8255_PORTB(X) (X + 1) /* PORT B */
- #define I8255_PORTC(X) (X + 2) /* PORT C */
- #define I8255_CNTRL(X) (X + 3) /* CONTROL */
-
- #define I8255_MAXCH 0x03 /* three IO ports */
-
- #define I8255_SET 0x80 /* configure set bit */
-
- #define I8255_PA_M0 0x20 /* A Mode 0 : Basic */
- #define I8255_PA_M1 0x40 /* A Mode 1 : Strobed */
- #define I8255_PA_M2 0x60 /* A Mode 2 : Bidir */
- #define I8255_PB_M0 0x00 /* B Mode 0 : Basic */
- #define I8255_PB_M1 0x04 /* B Mode 1 : Strobed */
-
- /* The bit masks for the port input configurations.
- * Corresponding bits are 0 if the port is configured
- * for output.
- */
- #define I8255_CL_IN 0x01 /* C Low Input */
- #define I8255_PB_IN 0x02 /* B Input */
- #define I8255_CH_IN 0x08 /* C High Input */
- #define I8255_PA_IN 0x10 /* A Input */
-
- /* 8255 Digital select mode:
- * PA 0-7 output, PB 0-7 output, PC 0-3 output,
- * PC 4-7 output
- * ALL ports in Mode 0
- */
- #define I8255_ALL_OP I8255_SET
-
- /* 8255 Digital select mode:
- * PA 0-7 input, PB 0-7 input, PC 0-3 input,
- * PC 4-7 input
- * ALL ports in Mode 0
- */
- #define I8255_ALL_IP ( I8255_SET | I8255_CL_IN | \
- I8255_PB_IN | I8255_CH_IN | \
- I8255_PA_IN )
-
- /* Error Definitions ------------------------*/
- #define I8255_ST_OK 0x0000 /* OK */
- #define I8255_ST_BB 0x0001 /* Bad Bit number */
- #define I8255_ST_BP 0x0001 /* Bad Port number */
-
- /* Data Structure ---------------------------*/
- #if !defined ( I8255DAT_STRUCT_DEFINED )
- typedef struct I8255dat_struct {
- int base; /* 8255 address */
- int stat; /* status flag */
- unsigned char mode; /* current mode */
- unsigned char adat; /* port A data */
- unsigned char bdat; /* port B data */
- unsigned char cdat; /* port C data */
- } I8255DAT;
- #define I8255DAT_STRUCT_DEFINED
- #endif
-
- /* Function Prototypes ----------------------*/
- /* These are the INP and OUTP functions used to
- * write and read from an 80X86 IO Port.
- */
- extern void chp_portwt (int d_port,
- unsigned char d_byte);
- extern void chp_portrd (int d_port,
- unsigned char *d_byte);
-
- /* ---------------------------------------------
- * END I8255GEN.H Header File
- * ---------------------------------------------
- */